package com.yuwei.message

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.yuwei.base.BaseViewModel
import com.yuwei.http.ApiService
import com.yuwei.http.entity.MessageEntity
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class MessageViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val messageSuccess by lazy { MutableLiveData<MessageEntity>() }
    fun getMessage(accessId: String, userId: Int) {
       viewModelScope.launch {
           executeNetwork({
               apiService.getMessage(accessId, userId)
           },messageSuccess::postValue)
       }
    }
}